﻿using System.ComponentModel;

namespace GENERIC.MVVM.Helpers
{
    /// <summary>
    /// Classe d'aide pour détécter si on est en mode design
    /// </summary>
    public static class DesignHelpers
    {
        #region Properties

        private static bool? _isInDesignMode;

        /// <summary>
        /// Obtient oui si on est en mode design, non sinon
        /// </summary>
        public static bool DesignMode
        {
            get
            {
                if (!_isInDesignMode.HasValue)
                {
#if !SILVERLIGHT
                    _isInDesignMode = new bool?(DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()));
#else
                _isInDesignMode = new bool?(DesignerProperties.IsInDesignTool);
#endif

                }
                return _isInDesignMode.Value;
            }
        }


        #endregion
    }
}
